import { createApp } from 'vue'
// 使用 @/styles/css/global.css 编译能通过，都是不能跳转
import App from './App.vue'
import { setupStore } from '@/store'
import { setupRouter } from '@/router'
import 'virtual:windi.css'
import './styles/css/global.css'

import { setAppTitle, setupMakeitCaptcha } from './utils'
import { setupWindicssDarkMode } from './utils'
// import { AppProvider } from './AppProvider.vue'

async function setupApp() {
  setAppTitle()
  // const naiveApp = createApp(AppProvider) // todo 20210818
  const app = createApp(App)
  // 图片验证码插件
  setupMakeitCaptcha(app)
  // 挂载全局状态
  setupStore(app)
  // naiveApp.mount('#naiveApp', true) //todo 20210818,源码解释: 优先挂载一下 naiveApp 解决路由守卫，Axios中可使用，Dialog，Message 等之类组件
  await setupRouter(app)
  app.mount('#app')
  setupWindicssDarkMode()
}

setupApp()
